package com.pmcc.cj.repository;

import com.pmcc.cj.entity.CjOrder;
import com.pmcc.cj.entity.CjTask;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by tomas on 2020/9/22.
 */
public interface CjOrderRepository extends JpaRepository<CjOrder,String> {
    Page<CjOrder> findAll(Specification<CjOrder> spec, Pageable var1);
    List<CjOrder> findByRobotIdAndOrderStatus(String robotId,Integer orderStatus);
    List<CjOrder> findByOrderIndexIdAndOrderStatusAndIsYun(String orderIndexId,Integer orderStatus,Integer isYun);
    List<CjOrder> findByOrderIndexId(String orderIndexId);
    @Modifying
    @Query(value ="select * from cj_order where customer_confirm!=1 and robot_confirm=1 ",  nativeQuery = true)
    List<CjOrder> findByRobotAndCustomer();
}
